#ifndef SETWIG_H
#define SETWIG_H

#include <QWidget>
#include <QUdpSocket>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QInputDialog>
#include "mqtt/qmqtt.h"
#include "globalval.h"
namespace Ui {
class SetWig;
}

class SetWig : public QWidget
{
    Q_OBJECT

public:
    explicit SetWig(QWidget *parent = 0);
    ~SetWig();
    void renderListWidgetItem(QString ip, int port);
    void setReportMode(int type, int period);
    void setRefreshBtnShow(bool isShow)
    {

    }
private:
    Ui::SetWig *ui;
    QUdpSocket *udpSocket;
    void sendBroadcast();
    void readPendingDatagrams();
    void onItemClicked(QListWidgetItem *item);
    void connectBtnClick();

private slots:
    void onComboBoxIndexChanged(int index);
    void refreshBtnClickSlot();

signals:
    void onDatagramRecv(QJsonObject);
    void connectTcpServer(QString ip, int port);
};

#endif // SETWIG_H
